<template>
  <div>
    <h4 style="margin:0 0 10px 0">流水记录 </h4>
      <el-row style="margin-bottom:10px">
        <el-col :span="14" >
          <div style="display:flex;align-items:center">
            <span>开始时间:</span>
            <el-date-picker v-model="beginTime" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker>
            <span>结束时间:</span>
            <el-date-picker v-model="endTime" type="date" value-format="yyyy-MM-dd" placeholder="选择日期"> </el-date-picker>
          </div>
        </el-col>
        <el-col :span="10" style="text-align:right">
          <el-input v-model="sheachValue" style="width:300px" placeholder="输入搜索内容"></el-input>
          <el-button type="primary" @click="seachFun">搜索</el-button>
        </el-col>
      </el-row>
      <water-table :tableData="tableData"></water-table>
      <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage4"
          :page-sizes="[10, 20, 30, 50]"
          :page-size="10"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
  </div>
</template>
<script>
import waterTable from './waterTable'
import Http from '@/Http/Http'


export default {
   components:{
    waterTable
  },
   data() {
      return {
        userRole:JSON.parse(sessionStorage.getItem('userSolt')),
        currentPage4: 1,//分野  
        total:0,      
        tableData: [],
        page:1,
        pageSize:10,
        sheachValue:'',
        beginTime:'',
        endTime:'',
       
      }
    },
    created() {
      this.getlist()
    },
    methods: {
       getlist() {
        const parm ={
          "pageIndex":this.page,
          "pageSize":this.pageSize,
          // "beginTime":'',
          // "endTime":''
        };
        if(this.sheachValue){
          parm.keyword = this.sheachValue
        };
        
        if(this.beginTime){
          parm.beginTime = this.beginTime
        }
        if(this.endTime){
          parm.endTime = this.endTime
        }
        Http.getWaterLIst(parm)
        .then( res => {
          this.tableData = res.data.data.rows;
          this.total = res.data.data.total;
          
        })
        .catch( error => {
          
        })
      },  
      timeFun(val) {
        return getTime(val)
      },     
       //分页
      handleSizeChange(val) {
        this.pageSize = val;
        this.getlist()
        
      },
      handleCurrentChange(val) {
        this.page = val;
        this.getlist()
        
      },
     
      seachFun(){
        this.getlist()
      }
    }
  
 
  
}
</script>

